(1) Field of the Invention
The present invention relates to video encoding device and method, and more particularly, to video encoding device and method for encoding a video signal in conformity with MPEG (Moving Picture Experts Group).
(2) Description of the Related Art
In recent years, encoding/compression techniques conformable to MPEG are widely used in DVDs (Digital Versatile Discs) and in the field of digital TV broadcasting, in order to record and transmit a vast amount of video data with high quality.
Also, digital video recorders, which are adapted to encode/compress an input video signal according to MPEG and then store the compressed bit stream on a DVD or HDD (Hard Disk Drive), and like devices have become popular on the market.
Encoding devices conformable to MPEG adopt one of two encoding schemes, namely, real-time encoding and 2-pass encoding. In real-time encoding, the set bit rate for encoding is nearly fixed, irrespective of video scene, so that the compressed bit stream may fit in the data size of given media.
On the other hand, 2-pass encoding is a variable-bit-rate encoding scheme wherein all video scenes are once encoded to obtain a history of detailed information during the encoding of the whole video material and then the information rate control for the second-pass encoding is scheduled in accordance with the historical information.
FIG. 6 shows the configuration of a real-time encoder. The real-time encoder 50 comprises encoding sections 51 and 52, a frame memory 53, and an encoding control section 54.
The encoding section 51 encodes a video signal (including audio) to generate a stream (encoded data) 5a, which is then output. Also, the encoding section 51 sends information, such as motion vectors obtained during the encoding, to the encoding control section 54 as stream information.
The frame memory 53 temporarily stores the input video signal and outputs the signal with a certain delay. The encoding control section 54 generates encoding control information from the received stream information, and sends the generated information to the encoding section 52. In accordance with the encoding control information, the encoding section 52 encodes the video signal output from the frame memory 53 and outputs a stream 5b obtained as a result.
Thus, the encoding section 51 first coarsely encodes the video signal to output the stream 5a at a relatively high bit rate (e.g., 15 Mbps). Then, using the information needed for the encoding, the encoding section 52 finely encodes the video signal to output the stream 5b at a lower bit rate (e.g., 5 Mbps) than the stream 5a. The stream 5a is sent, for example, to a recording medium such as an HDD, while the stream 5b is delivered through the Internet.
FIG. 7 shows the configuration of a 2-pass encoder. The 2-pass encoder 60 comprises encoding sections 61 and 62, a stream buffer (HDD etc.) 63, and an encoding control section 64. The term “pass” denotes the number of times one video material is encoded to be output as a stream.
The encoding section 61 is input with a whole sequence of video signal from beginning to end and encodes the video signal. The encoded stream is temporarily stored in the stream buffer 63. The encoding control section 64 analyzes features of the video signal, based on detailed information (motion vector information etc.) on the stream stored in the stream buffer 63, and generates encoding control information such as information rate control schedule.
The encoding section 62 is input with the same video signal as that encoded by the encoding section 61 after a lapse of a certain period of time (e.g., after a lapse of two hours if the video signal constitutes video content of two hours long). Then, in accordance with the encoding control information previously generated, the encoding section 62 performs second-pass encoding and outputs a stream 6a. This process permits encoding with much less deterioration in the image quality.
As techniques applicable to conventional encoding devices, there has been proposed a technique of encoding digital video data such that the video data is converted into a resolution, bit rate, etc. suited to the connected device (e.g., Unexamined Japanese Patent Publication No. 2001-045436 (paragraph no. [0018], FIG. 1)).
The real-time encoder 50 of FIG. 6 is required to broadcast a stream live to viewers, as explained above in the “Description of the Related Art” section, and because of the nature of live broadcasting, immediate processing must be given priority when encoding the stream for live delivery.
In the real-time encoder 50, however, since only a short time corresponding to the delay time of the frame memory 53 (e.g., a delay time corresponding to about one frame) can be allotted for the encoding control information to be notified from the encoding control section 54, it is not possible to obtain time-related information such as scene changes.
Thus, the video signal is encoded at a nearly constant bit rate, irrespective of video scene, and in cases where the input video scene switches to one having a complex picture pattern, for example, the scene fails to be encoded at a sufficient coding rate, giving rise to a problem that deterioration in the image quality, such as block noise, becomes conspicuous.
In the 2-pass encoder 60 of FIG. 7, on the other hand, the encoding control information is generated after the whole video is encoded by the first-pass encoding, thereby permitting the features of the video to be detected in advance. Accordingly, at the time of the second-pass encoding, the encoding control information can be used to allocate a high bit rate to complex video scenes and a low bit rate to plain video scenes, thus enabling encoding with less deterioration in the image quality.
However, the 2-pass encoder 60 requires a significantly long processing time to previously encode the video signal from beginning to end. Because of complete loss of the real-time property or simultaneity, a problem arises in that the 2-pass encoder cannot be used for the delivery of a live broadcast etc.
Thus, the real-time property and the improvement of image quality are in the trade-off relationship, and conventional encoding devices fall under either devices placing importance on the real-time property or devices placing importance on the improvement of image quality.
At present, an encoding device which has the real-time property to a certain degree (near-real-time property), not to the extent of perfect-real-time property, and in which deterioration in the image quality is restrained is not developed yet, and there has been a strong demand for such an encoding device. The aforementioned conventional technique (Unexamined Japanese Patent Publication No. 2001-045436) is directed to improving the image quality in accordance with the connected device and does not take account of the real-time property.